package com.tyl.factory工厂模式;

import com.tyl.factory工厂模式.jk.Car;

/**
 * @author 汽车制造商
 */
public class CarFactron {
    //方法1
    public static Car getcar (String name){
        if(name.equals("宝马")) {
            return new BMW();
        }else if (name.equals("野马")){
            return new Mustang();
        }else {
            return null;
        }
    }
    //方法2
    public static Car getBmw(){
        return new BMW();
    }
    public static Car getMustang(){
        return new Mustang();
    }
}
